package com.julu.appcloud.core.utils;

import com.julu.appcloud.core.security.shiro.realm.AuthRealm;
import org.apache.shiro.SecurityUtils;

/**
 *
 */
public class MySysUser {
    /**
     * 取出Shiro中的当前用户LoginName.
     */
    public static String icon() {
        return shiroUser().getIcon();
    }

    public static Long id() {
        return shiroUser().getId();
    }

    public static String loginName() {
        return shiroUser().getloginName();
    }

    public static String nickName(){
        return shiroUser().getNickName();
    }

    public static AuthRealm.ShiroUser shiroUser() {
        AuthRealm.ShiroUser user = (AuthRealm.ShiroUser) SecurityUtils.getSubject().getPrincipal();
        return user;
    }
}
